<template>
  <div class="bg-white my-[10px]">
    <BaseHead style="border-bottom: 0"> 成员信息</BaseHead>
    <el-table :data="memberList" class="w-full" border stripe>
      <el-table-column type="index" label="署名" width="60px" />
      <el-table-column label="成员类型">
        <template #default="{ row }">
          <CommonLabel :value="row.memberType" :dataList="members" />
        </template>
      </el-table-column>
      <el-table-column prop="personName" label="姓名" />
      <el-table-column label="工作单位">
        <template #default="{ row }">
          <CommonTreeLabel
            :value="row.unitId"
            :dataList="allUnitList"
            valueKey="codeColumn"
            labelKey="valueColumn"
            v-if="row.memberType != 3"
          />
          <span v-else>{{ row.unitName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出生年月">
        <template #default="{ row }">
          <DateLabel :value="row.birthday" format="YYYY-MM" />
        </template>
      </el-table-column>
      <el-table-column label="行政职务">
        <template #default="{ row }">
          <CommonLabel :value="row.executivePost" :dataList="executivePostList" />
        </template>
      </el-table-column>
      <el-table-column label="职称">
        <template #default="{ row }">
          <CommonTreeLabel :value="row.titleId" :dataList="applierTitleList" />
        </template>
      </el-table-column>
      <el-table-column prop="division" label="项目分工" />
    </el-table>
  </div>
</template>

<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import { sbMemberDetail } from "@/api/project/xj/sbxm";
import CommonLabel from "@/views/project/components/CommonLabel.vue";
import CommonTreeLabel from "@/views/project/components/CommonTreeLabel.vue";
import DateLabel from "@/views/project/components/DateLabel.vue";
const operateId = inject("id");
const executivePostList = inject("executivePostList"); //行政职务
const applierTitleList = inject("applierTitleList"); //职称
const allUnitList = inject("allUnitList");
const members = inject("memberList");
const memberList = ref([]);
//获取数据详情
const getDetail = async () => {
  const params = {
    id: operateId.value,
  };
  try {
    const res = await sbMemberDetail(params);
    memberList.value = res.data.members;
  } catch (error) {
    console.log(error);
  }
};
onMounted(() => {
  getDetail();
});
</script>

<style scoped lang="scss"></style>
